import axios from "../utils/request";

export function login(data) {
    return axios({
        url: '/login',
        method: 'post',
        data
    })
}
export function register(data) {
    return axios({
        url: '/register',
        method: 'post',
        data
    })
}

export function userInfo(id) {
    return axios({
        url: '/user/' + id,
        method: 'get',
        headers: {
            Authorization: localStorage.getItem('Token')
        }
    })
}

export function upload(data) {
    return axios({
        url: '/upload',
        method: 'post',
        data
    })
}

export function userUpdate(id, data) {
    return axios({
        url: '/user_update/' + id,
        method: 'post',
        data
    })
}

export function user_follows(id) {
    return axios({
        url: '/user_follows/' + id,
        method: 'get'
    })
}
export function user_unfollow(id) {
    return axios({
        url: '/user_unfollow/' + id,
        method: 'get'
    })
}

export function follows() {
    return axios({
        url: '/user_follows',
        method: 'get'
    })
}
export function userStar() {
    return axios({
        url: '/user_star',
        method: 'get'
    })
}
export function userComments() {
    return axios({
        url: '/user_comments',
        method: 'get'
    })
}
//搜索文章
export function searchPage(params) {
    return axios({
        url: '/post_search',
        method: 'get',
        params
    })
}
//标签管理
export function labelmanage(params) {
    return axios({
        url: '/category',
        method: 'get',
        params
    })
}